#ifndef DRSCONTROL_H
#define DRSCONTROL_H

#include <QtGui/QMainWindow>
#include "ui_drscontrol.h"
#include "ui_about.h"
#include <QTcpSocket>
#include <QIcon>
#include "qextserialport.h"
#include "firewire.h"
#include "deviceSetup.h"

#define SI9475_LOW_ADDR 0xFFF10000
#define SI9475_COM1_RADIO_DROP_ADDR 0xFFF10800

class           UsbAsyncMgr;
class           UsbDevice;
class           Graph;



enum message_levels{
	INFO,
	WARNING,
	CRITICAL,
	QUESTION
};
class DRSControl : public QMainWindow
{
	Q_OBJECT

public:
	DRSControl(QWidget *parent = 0, Qt::WFlags flags = 0);
	~DRSControl();
	void createSerialPort();
	BaudRateType getBuadRate();
	bool fileSave();
	bool fileSaveAs();
	void setCurrentFileName(const QString &fileName);
	int sendCommand(const char* cmd, unsigned long low_addr, VhpdReference ref);
	int sendQuery(const char *query, char *resp, int respSize, unsigned long low_addr, VhpdReference ref);
	void errorDisplay(int warningLevel, QString title, QString text);
	
public slots :

private slots :
	void readFromSock();
	void displayError(QAbstractSocket::SocketError socketError);
	void on_inputLineEdit_returnPressed( void );
	void on_actionAbout_triggered(bool checked);
	void on_openPortPushButton_clicked(bool clicked);
	void on_serialMessageLineEdit_returnPressed(void);
	void receiveMsg();
	void transmitMsg();
	void on_actionSave_triggered(bool checked);
	void on_firewirePushButtonOpen_clicked( bool clicked);
	void on_firewirePushButtonSend_clicked(bool clicked);
	void on_firewireLineEdit_returnPressed(void);
	void on_serialClearPushButton_clicked(bool clicked);

private:
	Ui::DRSControlClass ui;
	QTcpSocket *sock;
	quint16 blockSize;
	QString currentText;
	QString windowTitle;
	QextSerialPort *port;
	QString fileName;
	VhpdReference gVhpdReference;
	bool isFirewireOpen;
	long get_address();
	QString firewireErrorMsg;
	void firewireDetermineError(int err_val);
	double mMinPhaseDegrees;
	double mMaxPhaseDegrees;
	DeviceSetup* mDeviceSetupDialog;
};



#endif // DRSCONTROL_H
